<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>File: wordnet.rb</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



  <div id="fileHeader">
    <h1>wordnet.rb</h1>
    <table class="header-table">
    <tr class="top-aligned-row">
      <td><strong>Path:</strong></td>
      <td>lib/wordnet.rb
      </td>
    </tr>
    <tr class="top-aligned-row">
      <td><strong>Last Update:</strong></td>
      <td>Wed Jul 09 23:04:26 +0000 2008</td>
    </tr>
    </table>
  </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
<a href="../../classes/WordNet.html">WordNet</a> - A Ruby interface to the
<a href="../../classes/WordNet.html">WordNet</a> lexical database
</p>
<h2>Synopsis</h2>
<pre>
  require &quot;WordNet&quot;

  # Create a new lexicon object
  lex = WordNet::Lexicon::new

  # Look up the synsets for &quot;language&quot; and &quot;computer program&quot;
  languageSynset = lex.lookup_synsets( &quot;language&quot;, WordNet::Noun, 3 )
  programSynset = lex.lookup_synsets( &quot;program&quot;, WordNet::Noun, 3 )

  # Create a new synset for programming languages, set its gloss, link it to its
  # hypernym and holonym, and save everything to the database.
  progLangSynset = lex.create_synset( &quot;programming language&quot;, WordNet::Noun )
  progLangSynset.gloss = &quot;a system of human-readable symbols and words &quot; #               &quot;for encoding instructions for a computer&quot;
  progLangSynset.hypernyms += languageSynset
  languageSynset.hyponyms += progLangSynset
  progLangSynset.holonyms += programSynset
      programSynset.stuff_meronyms += progLangSynset
  [ progLangSynset, programSynset, languageSynset ].each do |synset|
        synset.store
  end

  # Create a new synset for Ruby, link it, and save it
  rubySynset = lex.create_synset( &quot;Ruby&quot;, Wordnet::Noun )
  rubySynset.gloss = &quot;an interpreted scripting language for quick and easy object-oriented programming&quot;
  rubySynset.hypernyms += languageSyn ; languageSynset.hyponyms += rubySyn
  rubySynset.write ; languageSynset.write
</pre>
<h2>Description</h2>
<p>
This is a Ruby interface to the <a
href="../../classes/WordNet.html">WordNet</a> lexical database. It&#8216;s
mostly a port of Dan Brian&#8216;s Lingua::Wordnet Perl module, modified a
bit to be more Ruby-ish.
</p>
<h2>Author</h2>
<p>
The Lingua::Wordnet module by Dan Brian, on which this code is based, falls
under the following license:
</p>
<pre>
  Copyright 1999,2000,2001 by Dan Brian.

  This program is free software; you can redistribute it and/or modify
  it under the same terms as Perl itself.
</pre>
<p>
Written by Michael Granger &lt;ged@FaerieMUD.org&gt;
</p>
<p>
Copyright (c) 2002,2003,2005 The FaerieMUD Consortium. All rights reserved.
</p>
<p>
This module is free software. You may use, modify, and/or redistribute this
software under the terms of the Perl Artistic License. (See <a
href="http://language.perl.com/misc/Artistic.html">language.perl.com/misc/Artistic.html</a>)
</p>
<h2>Version</h2>
<pre>
 $Id: wordnet.rb 90 2008-07-09 23:02:53Z deveiant $
</pre>

    </div>

    <div id="requires-list">
      <h3 class="section-bar">Required files</h3>

      <div class="name-list">
      crosscase&nbsp;&nbsp;
      wordnet/constants&nbsp;&nbsp;
      wordnet/lexicon&nbsp;&nbsp;
      wordnet/synset&nbsp;&nbsp;
      </div>
    </div>

   </div>


  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>